package com.cloudbroker.openapi.manage.controller;

import com.cloudbroker.bcs.common.entity.HSBCPSBackVO;
import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.user.back.UserRemindQryBack;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.user.vo.AllRemindSaveForm;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.user.vo.RemindSaveForm;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.user.vo.UserRemindQryForm;
import com.cloudbroker.bcs.platform.ltb.bizapi.t2service.business.UserRemindT2BizService;
import com.cloudbroker.bcs.platform.ltb.common.ext.annotation.SaveLog;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import static com.cloudbroker.bcs.platform.ltb.common.util.RequestUtil.getSingleParameterMapForBody;

/**
 * Created by daibd19671 on 2016/11/18.
 */
@Controller
public class UserRemindController {

    @Resource
    private UserRemindT2BizService userRemindT2BizService;

    /**
     * 用户提醒设置查询
     * */
    @ResponseBody
    @RequestMapping("/user_remind_qry")
    @SaveLog(remark = "用户提醒设置查询")
    public UserRemindQryBack func_user_remind_qry(HttpServletRequest request, String jsonpcallback){
        UserRemindQryForm form = getSingleParameterMapForBody(request , UserRemindQryForm.class);
        return VOUtil.setJsonpResult(userRemindT2BizService.func_user_remind_qry(form), jsonpcallback);
    }

    /**
     * 设置提醒
     * */
    @ResponseBody
    @RequestMapping("/save_remind")
    @SaveLog(remark = "设置提醒")
    public HSBCPSBackVO func_save_remind(HttpServletRequest request, String jsonpcallback){
        RemindSaveForm form = getSingleParameterMapForBody(request , RemindSaveForm.class);
        return VOUtil.setJsonpResult(userRemindT2BizService.func_save_remind(form), jsonpcallback);
    }

    /**
     * 用户关闭所有组合提醒
     * */
    @ResponseBody
    @RequestMapping("/save_all_remind")
    @SaveLog(remark = "用户关闭所有组合提醒")
    public HSBCPSBackVO func_save_all_remind(HttpServletRequest request, String jsonpcallback){
        AllRemindSaveForm form = getSingleParameterMapForBody(request , AllRemindSaveForm.class);
        return VOUtil.setJsonpResult(userRemindT2BizService.func_save_all_remind(form), jsonpcallback);
    }
}
